import request from '@/plugins/request';
import { remove } from 'js-cookie';
///查询单条
export function GetData (id) {
    return request({
        url: `/api/digitalcanteen/consumeLog/${id}`,        
        method: 'get'
    });
}
///查询多条
export function GetList (param,query) {
    return request({
        url: `/api/digitalcanteen/consumeLog/consumelist?pageIndex=${param.pageIndex}&pageSize=${param.pageSize}&sortType=${param.sortType}&sortKey=${param.sortKey}&persontype=${query.persontype}`,
        method: 'get'
    });
}
///查询多条报表
export function GetRptList (param) {
    return request({
        url: `/api/digitalcanteen/consumelog/consumerptlist?orgcode=${param.orgcode}&productid=${param.productid}&startdate=${param.startdate}&enddate=${param.enddate}&persontype=${param.persontype}`,
        method: 'get'
    });
}
//新增、更新（data.id为空或没有id参数时为新增）
export function SaveData (data) {
    if(data.hasOwnProperty("id")){
        if(!data.id) delete data.id;
    }
    return request({
        url: `/api/digitalcanteen/consumeLog/`,    
        data:data,     
        method: 'post'
    });
}
//删除多条，id间用“,”分隔
export function Delete (idList) {
    return request({
        url: `/api/digitalcanteen/consumeLog?idList=${idList}`,        
        method: 'delete'
    });
}
//导出消费记录
export function ExportConsumeLog(personType)
{
    return request({
        url:`/api/digitalcanteen/consumeLog/exportConsumeLog?personType=${personType}`,
        method:'get'
    });
}
//用餐报表
export function ExportConsumeRep(param)
{
    return request({
        url:`/api/digitalcanteen/consumeLog/exportConsumeRep??orgcode=${param.orgcode}&productid=${param.productid}&startdate=${param.startdate}&enddate=${param.enddate}&persontype=${param.persontype}`,
        method:'get'
    });
}

//查询数据源数据
/*
export function consumeLogDataSource () {
    return request({
        url: `/api/digitalcanteen/consumeLog/consumeLogdatasource`,        
        method: 'get'
    });
}
*/
